package edu.msg.hrappy.web.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;
import java.util.Properties;

import javax.ejb.EJB;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.print.DocFlavor.BYTE_ARRAY;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import edu.msg.hrappy.backend.model.Candidate;
import edu.msg.hrappy.backend.model.Comment;
import edu.msg.hrappy.backend.model.User;
import edu.msg.hrappy.backend.service.CandidateService;
import edu.msg.hrappy.backend.service.util.MailNotification;

public class AlohaServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	@EJB
	private CandidateService candidateService;
	
 
    public AlohaServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		
		//Long id=Long.parseLong(request.getParameter("candidateId"));
		
		//Candidate candidate=candidateService.getById(id);
		
		  	 String emailMessage;
	         emailMessage="<p>This is actual message</p>";
	         //emailMessage=emailMessage+"<p>"+candidate.getFileName()+" "+candidate.getLastName()+"</p>";
	         emailMessage=emailMessage+"<p><a href=\"http://localhost:8080/hrappy-web/ShowAllCandidates\">Here</a> you can find a link to the candidate:</p>";
		
	         MailNotification mail=new MailNotification();
	         mail.sendMessage("hrappyhrappy@yahoo.ro", emailMessage, "Candidate accepted");

	        
	         
	       
	  
		
		
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
